<template>
	<view class="paymentMethod bank">
		<view class="paymentMethod-title">
			选择银行卡
		</view>
		<view class="wallet">
			<image class="wallet-right" src="../../../../static/funds/paymentMethod/right.png" mode=""></image>
			<view class="wallet-item">
				<image class="wallet-img" src="../../../../static/funds/paymentMethod/wallet.png" mode=""></image>
				<text class="wallet-text">钱包支付</text>
			</view>
		</view>
		
		<view class="Other-payment" @tap="otherPay()">

			<image class="Other-img" src="../../../../static/funds/paymentMethod/add.png" mode=""></image>
			<text class="Other-text">其他方式支付</text>
		</view>
		
		<view class="ul" v-if="show">
			<view class="li" v-for="item in bankCard" :key="item.id">
				<image :src="item.logo" mode=""></image>
				<text>{{item.name}}</text>
			</view>
			<view class="li">
				<image class="Other-img" src="../../../../static/funds/paymentMethod/add.png" mode=""></image>
				<text @tap="binding_bank()">绑定银行卡</text>
			</view>
		</view>
		
		<!-- 按钮 -->
		<view class="payment-btn" @tap="goPayYes">
			确认支付{{$store.state.money}}.00
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				bankCard: [{
						_id: 1,
						name: "中国建设银行",
						logo: "https://z3.ax1x.com/2021/04/09/cUgAHI.png",
						state: 0
					},
					{
						_id: 2,
						name: "中国农业银行",
						logo: "https://z3.ax1x.com/2021/04/09/cUhgjU.png",
						state: 0
					},
					{
						_id: 3,
						name: "浦发银行",
						logo: "https://z3.ax1x.com/2021/04/09/cUh5NR.png",
						state: 0
					},
					{
						_id: 4,
						name: "中国银行",
						logo: "https://z3.ax1x.com/2021/04/09/cUh736.png",
						state: 0
					},
					{
						_id: 5,
						name: "中国邮政银行",
						logo: "https://z3.ax1x.com/2021/04/09/cUhvEd.png",
						state: 0
					},
				],
				show:false
			}
		},
		methods: {
			goPayYes() {
				if(this.$store.state.bankID){
					uni.navigateTo({
						url: '../../../payYes/payYes'
					})
				}else{
					uni.showModal({
					    title: '提示',
					    content: '你还未绑定银行卡',
					    success: function (res) {
					        if (res.confirm) {
					            uni.navigateTo({
					            	url:"../../../payFinancial/payFinancial"
					            })
					        } else if (res.cancel) {
					            console.log('用户点击取消');
					        }
					    }
					});
				}
				
			},
			otherPay() {
				this.show=!this.show
			},
			binding_bank(){
				uni.navigateTo({
					url:"../../../payFinancial/payFinancial"
				})
			}
		}
	}
</script>

<style scoped lang="scss">
	.ul{
		width: 100vw;
		display: flex;
		flex-direction: column;
		justify-content: flex-start;
		margin-top: 20rpx;
		background-color: #fff;
		transition: all 1s;
		.li{
			display: flex;
			align-items: center;
			margin-left: 50rpx;
			margin-bottom: 20rpx;
			transition: all 1s;
			image{
				width: 32rpx;
				height: 32rpx;
				margin-right: 20rpx;
			}
		}
	}
	.paymentMethod {
		width: 100vw;
		height: 100vh;
		box-sizing: border-box;
		background-color: #f5f5f5;
		display: flex;
		flex-direction: column;
		align-items: center;
	}

	.paymentMethod-title {
		width: 100vw;
		font-size: 28rpx;
		color: #999;
		padding: 40rpx 0 20rpx 40rpx;
		border-top: 1rpx solid #f7f7f7;
		background-color: #fff;
	}

	.wallet {
		width: 100vw;
		box-sizing: border-box;
		display: flex;
		align-items: center;
		background-color: #fff;
	}

	.wallet-right {
		width: 10rpx;
		height: 16rpx;
		margin: 0 20rpx;
	}

	.wallet-item {
		width: 670rpx;
		padding: 30rpx 0;
		border-top: 1rpx solid #f7f7f7;
		border-bottom: 1rpx solid #f7f7f7;
	}

	.wallet-img,
	.Other-img {
		width: 30rpx;
		height: 30rpx;
		vertical-align: middle;
	}

	.wallet-text,
	.Other-text {
		font-size: 32rpx;
		margin-left: 20rpx;
		vertical-align: middle;
		color: #333;
	}

	.Other-payment {
		width: 100vw;
		box-sizing: border-box;
		padding: 30rpx 50rpx;
		background-color: #fff;
	}

	.payment-btn {
		width: 670rpx;
		height: 88rpx;
		background-color: #3476f1;
		color: #fff;
		font-size: 28rpx;
		margin: 0 auto;
		position: absolute;
		bottom: 0;
		display: flex;
		justify-content: center;
		align-items: center;
		border-radius: 5rpx;
	}
</style>
